CSC 453

Winter 2026 Day 2

Admin

  • Quiz 1 due Friday
    • NOTE: this first quiz allows unlimited attempts. The rest will not.
  • Lab 1 due Monday
  • Assignment 1 due Jan 19
    • I’ll talk a bit about this during lab today
  • I realize this seem like a lot, but time is short

OS abstractions

Questions to consider

  • What are the main abstractions OSes provide?
  • What are the abstraction challenges?

Abstractions

  • Abstractions simplify application design by:
    • hiding undesirable properties,
    • adding new capabilities, and
    • organizing information
  • Abstractions provide an interface to application programmers that separates policy—what the interface commits to accomplishing—from mechanism—how the interface is implemented.

What are the abstractions?

  • CPUs
    • Processes, threads
  • Memory
    • Address space
  • Disk
    • Files

Example OS abstraction: file systems

  • What undesirable properties do file systems hide?
    • Disks are slow!
    • Chunks of storage are actually distributed all over the disk
    • Disk storage may fail!
  • What new capabilities do files add?
    • Growth and shrinking
    • Organization into directories, searchability
  • What information do files help organize?
    • Ownership and permissions
    • Access time, modification time, type, etc.

Abstraction tradeoffs - discussion

  • Identify undesirable properties hidden by, new capabilities added, and info organization provided with these abstractions:
    • Process / threads
    • Address space

Abstraction pros / cons

  • Advantages of OS providing abstractions?
    • Allow applications to reuse common facilities
    • Make different devices look the same
    • Provide higher-level or more useful functionality
  • Challenges?
    • What are the correct abstractions?
    • How much should be exposed?

OS design requirements - what do we need?

  • Convenience, abstraction of hardware resources for user programs
  • Efficiency of usage of CPU, memory, etc.
  • Isolation between multiple processes
  • Reliability, the OS must not fail
  • Other:
    • Security
    • Mobility

What isn’t clear?

Comments? Thoughts?

Resource management

Questions to consider

  • How does the OS manage access to resources?

OS as a resource manager

  • Another view: resource manager - shares resources “well”
  • Advantages of the OS managing resources?
    • Protect applications from one another
    • Provide efficient access to resources (cost, time, energy)
    • Provide fair access to resources
  • Challenges?
    • What are the correct mechanisms?
    • What are the correct policies?

Resources are managed via services

  • Program Execution (loading, running, monitoring, terminating)
  • Performance (optimizing resources under constraints)
  • Correctness (overseeing critical operations, preventing interference)
  • Fairness (access to and allocation of resources)
  • Error detection & recovery (network partition & media failure)

Services (cont’d)

  • Communication (inter-process, software-to-hardware, hardware-to-hardware, system-to-system, wide-area)
  • I/O: reading & writing, support for various mediums, devices, performance, and protections
  • Data Organization (naming), Services (search) & Protection (access control)
  • Security (isolation, enforcement, services, authentication, accounting and logging, trust)
  • User interfaces (command-line, GUIs, multiple users)

Each service has challenges and tensions

Example 1: We have limited RAM, and we want to run more programs that can be stored.

  • How do we allocate space?
  • Who stays?
  • Who goes?
  • What if we’re wrong?
  • What if the system is under extremely heavy load?
  • Is there a way to predict the future?

Each service has challenges and tensions

Example 2: We have two process (producer / consumer); how do they communicate?

  • Message passing? Shared memory?
  • How do they synchronize?
    • How to we prevent over-production? Over-consumption?
    • Context-switching?

What isn’t clear?

Comments? Thoughts?

Boot chain

Questions to consider

  • What is the chain of events that takes place before you are able to run a process?
  • Where do the different parts of the chain reside? How are they called?

Boot is like a relay race

  • A sequence of programs
  • Each stage:
    • Has slightly more power
    • Loads the next stage
    • Jumps to it

Power-On

  • CPU resets
  • Instruction pointer set to a fixed address
  • Execution begins in firmware (ROM)
  • The CPU does not know what an OS is

Firmware (BIOS / UEFI)

  • Initializes RAM
  • Initializes minimal hardware
  • Finds one program to run (bootloader)
  • Loads it into memory
  • Jumps to it

Bootloader’s job (GRUB Example)

  • Understand filesystems

  • Load the kernel image

  • Load the initramfs

  • Pass arguments to the kernel

  • Jump to the kernel entry point

  • Provides kernel command line args

    root=/dev/sda1
    init=/sbin/init
    console=ttyS0

What the bootloader does not do

  • Does not schedule processes
  • Does not manage memory long-term
  • Does not run the OS

Kernel

Think of the kernel in phases

  1. Self-setup
  2. Hardware abstraction
  3. Userspace handoff

Kernel self-setup

  • Sets up page tables
  • Enables virtual memory
  • Initializes scheduler
  • Sets up interrupts

The kernel cannot rely on anything yet: it is building the world.

Kernel hardware abstractions

This is where hardware becomes an abstraction.

  • Detects hardware
  • Loads drivers
  • Turns devices into files:
    • /dev/sda
    • /dev/tty
  • Creates kernel threads

Userspace handoff

  • Mounts the root filesystem

  • Chooses one program to run

  • Executes it with execve()

    execve("/sbin/init", ...);

Init (PID 1)

  • First userspace process
  • Always PID 1
  • Parent of all other processes

If PID 1 exits?

  • The kernel panics or shuts down

What isn’t clear?

Comments? Thoughts?

Kernel basics

Questions to consider

  • What are the different kernel paradigms?
  • Why would you choose one over the other?

Paradigms

  • The OS offers a number of services. What should go in the kernel?
    • IPC
    • VFS
    • File system
    • Scheduler
    • Virtual Memory
    • Device drivers

Monolithic kernels

  • Oldest, very common design (Linux, Windows 9x, BSDs)
  • Single piece of code in memory
  • Limited information hiding
    • One part of the kernel can directly access data and functions of other parts

Monolithic kernels (cont’d)

  • Q: What happens when you need something new supported (new hardware device, new system call, new filesystem)?
  • Modules (loadable kernel modules - LKMs) allow for flexibility, customization, support
    • Pros?
      • Memory savings
      • Flexibility
      • Minimal downtime
    • Cons?

Layered kernels

  • Dijkstra created the THE OS in the 60s, introducing the concept Each inner layer is more privileged; required a trap to move down layers
  • Hardware-enforcement possible
  • Intel announced in May 2024 that the new architectures will only have rings 0 and 3

Microkernels

  • Popular research area long ago, didn’t win (although people remain interested in the principles)
  • All non-essential components removed from the kernel, for modularization, extensibility, isolation, security, and ease of management
  • A collection of OS services running in user space
  • Downsides?
    • Heavy communication costs through message passing (marshaled through the kernel)

Monolithic vs Microkernel

What isn’t clear?

Comments? Thoughts?